Make computed value of border-width 0 if border-style none
authorAlexander Larsson <alexl@redhat.com>
Thu, 24 Nov 2011 17:38:53 +0000 (18:38 +0100)
committerAlexander Larsson <alexl@redhat.com>
Fri, 25 Nov 2011 14:36:08 +0000 (15:36 +0100)
From the css docs at http://www.w3.org/TR/CSS2/box.html:

    8.5.1 Border width: 'border-top-width', 'border-right-width', 'border-bottom-width',
    'border-left-width', and 'border-width'

    Computed value:   absolute length; '0' if the border style is 'none' or 'hidden'

gtk/gtkstylecontext.c

index b2993ecfee847d0541d351c67631498445dc958a..82cec95d81b3a3f81977620aa55bd49dfc769c6e 100644 (file)
@@ -3347,6 +3347,7 @@ gtk_style_context_get_border (GtkStyleContext *context,
   GtkStyleContextPrivate *priv;
   StyleData *data;
   int top, left, bottom, right;
+  GtkBorderStyle border_style;
 
   g_return_if_fail (border != NULL);
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -3357,16 +3358,27 @@ gtk_style_context_get_border (GtkStyleContext *context,
   data = style_data_lookup (context);
   gtk_style_properties_get (data->store,
                             state,
+                           "border-style", &border_style,
+                            "border-top-width", &top,
                             "border-top-width", &top,
                             "border-left-width", &left,
                             "border-bottom-width", &bottom,
                             "border-right-width", &right,
                             NULL);
-
-  border->top = top;
-  border->left = left;
-  border->bottom = bottom;
-  border->right = right;
+  if (border_style == GTK_BORDER_STYLE_NONE)
+    {
+      border->top = 0;
+      border->left = 0;
+      border->bottom = 0;
+      border->right = 0;
+    }
+  else
+    {
+      border->top = top;
+      border->left = left;
+      border->bottom = bottom;
+      border->right = right;
+    }
 }
 
 /**